- page_title _("Repository Analytics")
- add_page_specific_style 'page_bundles/graph_charts'

.mb-3
  %h3
    = _("Repository Analytics")

.repo-charts
  %h4.sub-header
    = _("Programming languages used in this repository")

  %p
    = _("Measured in bytes of code. Excludes generated and vendored code.")

  #js-languages-chart{ data: { chart_data: @languages.to_json.html_safe } }

- if defined?(@daily_coverage_options)
  .repo-charts.my-5
    #js-code-coverage-chart{ data: project_coverage_chart_data_attributes(@daily_coverage_options, @ref) }

.repo-charts
  .sub-header-block.border-top

  .row.tree-ref-header
    .col-md-6
      %h4
        - start_time = capture do
          #{@commits_graph.start_date.strftime('%b %d')}
        - end_time = capture do
          #{@commits_graph.end_date.strftime('%b %d')}
        = (_("Commit statistics for %{ref} %{start_time} - %{end_time}") % { ref: "<strong>#{h @ref}</strong>", start_time: start_time, end_time: end_time }).html_safe
      = _("Excluding merge commits. Limited to %{limit} commits.") % {limit: number_with_delimiter(@commits_limit, delimiter: ',')}

    .col-md-6
      .tree-ref-container
        .tree-ref-holder
          #js-project-graph-ref-switcher{ data: { project_id: @project.id, graph_path: project_graph_path(@project, @id), project_branch: current_ref } }
        %ul.breadcrumb.repo-breadcrumb
          = commits_breadcrumbs

  .row
    .col-md-6
      %ul.commit-stats
        %li
          - total = capture do
            #{@commits_graph.commits.size}
          = (_("Total: %{total}") % { total: "<strong>#{total} commits</strong>" }).html_safe
        %li
          - average = capture do
            #{@commits_graph.commit_per_day}
          = (_("Average per day: %{average}") % { average: "<strong>#{average} commits</strong>" }).html_safe
        %li
          - authors = capture do
            #{@commits_graph.authors}
          = (_("Authors: %{authors}") % { authors: "<strong>#{authors}</strong>" }).html_safe
    .col-md-6
      %p.slead
        = _("Commits per day of month")
      %div
        #js-month-chart{ data: { chart_data: @commits_per_month.to_json.html_safe } }
  .row
    .col-md-6
    .col-md-6
      %p.slead
        = _("Commits per weekday")
      %div
        #js-weekday-chart{ data: { chart_data: @commits_per_week_days.to_json.html_safe } }
  .row
    .col-md-6
    .col-md-6
      %p.slead
        = _("Commits per day hour (UTC)")
      %div
        #js-hour-chart{ data: { chart_data: @commits_per_time.to_json.html_safe } }
